<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>欢迎光临 Music Store</title>
	<link type="text/css" rel="Stylesheet" href="${pageContext.request.contextPath }/style/front.css"/>
 	<script src="${pageContext.request.contextPath}/script/jquery-1.10.2.js"></script>
	<script src="${pageContext.request.contextPath}/script/jquery.validate.js"></script>
	<script>
		 $(function(){
			$("#form").validate({
				rules:{
					"user.username":{
						required:true,
						remote:"checkUsername"
					},
					pwd:{
						required:true
					},
					"user.password":{
						required:true,
						equalTo:"#pwd"
					},
					"user.name":{
						required:true
					},
					"user.address":{
						required:true
					},
					"user.phone":{
						required:true
					},
					"user.email":{
						required:true,
						email:true
					}
				},
				messages:{
					"user.username":{
						required:"请输入用户名",
						remote:"该用户名已存在，请重新指定"
					},
					pwd:{
						required:"请输入密码"
					},
					"user.password":{
						required:"请再次输入密码",
						equalTo:"两次密码输入不一致"
					},
					"user.name":{
						required:"请输入姓名"
					},
					"user.address":{
						required:"请输入地址"
					},
					"user.phone":{
						required:"请输入电话"
					},
					"user.email":{
						required:"请输入邮箱地址",
						email:"邮箱地址不正确，请重新输入"
					}
				}
			});
		}); 
	</script>
 	<style>
 		#main table{margin:15px 40px;}
 		#main table td{padding-bottom:5px;}
 	</style>
  </head>
  <body>
    <div id="wrapper">
    	<s:action name="header" executeResult="true" namespace="/"></s:action>
    	<div id="content">
    		<s:action name="sidebar" executeResult="true" namespace="/"></s:action>
    		<div id="main">
    			<h3 id="main-title">用户注册</h3>
    			<form method="post" action="register" id="form">
    			<table>
    				<tr>
    					<td>用户名：</td>
    					<td><input type="text" name="user.username"/></td>
    				</tr>
    				<tr>
    					<td>密码：</td>
    					<td><input type="password" name="pwd" id="pwd"/></td>
    				</tr>
    				<tr>
    					<td>密码确认：</td>
    					<td><input type="password" name="user.password"/></td>
    				</tr>
    				<tr>
    					<td>姓名：</td>
    					<td><input type="text" name="user.name"/></td>
    				</tr>
    				<tr>
    					<td>地址：</td>
    					<td><input type="text" name="user.address"/></td>
    				</tr>
    				<tr>
    					<td>电话：</td>
    					<td><input type="text" name="user.phone"/></td>
    				</tr>
    				<tr>
    					<td>email：</td>
    					<td><input type="text" name="user.email"/></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td><input type="submit" value="注册"/></td>
    				</tr>
    			</table>
    			</form>
    		</div>
    		<div class="clearBoth"></div>
    	</div>
    	<%@ include file="../shared/footer.jsp" %>
    </div>
  </body>
</html>
